<!-- 选择服务器--分组 -->
<template>
  <div>
    <span>服务器 </span>
    <el-cascader
      :options="options"
      :props="props"
      collapse-tags
      clearable
      size="small"
      @change="handleChangeServer">
   </el-cascader>
  </div>
</template>

<script>
import { serverGroupOpt } from '@/api/aboutOptions'

  export default {
    data() {
      return {
        props: { multiple: true },
        options: []
      };
    },

    created(){
      this.getServer()
    },

    methods: {
    // 获取服务器
    async getServer() {
      const res = await serverGroupOpt()
      this.options = res.data.data.groups
    },

    // 选中服务器
    handleChangeServer(value) {
      let newValue = value.map(i=>i[i.length-1])
      this.$emit('server-event',newValue)
    }
  }
  };
</script>


<style>

</style>